<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>查看作业</title>
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>

    <link rel="stylesheet" href="../js/libs/sui/sm.min.css">
    <link rel="stylesheet" href="../iconfont/iconfont.css">
    <link rel="stylesheet" href="../less/main.css"/>
    <link rel="stylesheet" href="../js/libs/scale/scale.css"/>

    <script type='text/javascript' src='../js/libs/jquery-3.1.0.min.js' charset='utf-8'></script>
    <script type="text/javascript">
        var Zepto = jQuery;
    </script>
    <script type='text/javascript' src='../js/libs/sui/sm.min.js' charset='utf-8'></script>
    <script src="../js/libs/juicer-min.js"></script>
    <script src="../js/libs/jquery.md5.js"></script>
    <script src="../js/api.js"></script>
    <script src="../js/utils.js"></script>
    <script src="../js/common.js"></script>
    <script src="../js/libs/scale/scale.js"></script>
</head>
<body>
<!--消息中心-->
<div class="page">
    <!-- 头部-->
    <div class="head-no-toolbar bg-self-green no-left-icon">
        <span class="icon iconfont c-white p-l" onclick="javascript:api.closeWin();">&#xe61f;</span>
        <span class="c-white t-center">查看作业</span>
    </div>
    <div class="content t-22 add-homework my-homework-detail">
        <div class="content-block">
            <div class="list-block m-t-0">
                <div class="table-wrap bg-white p-5">
                    <table>
                        <tr>
                            <td class="t-top" colspan="2">
                                <div class="item-content">
                                    <div class="item-title label">题目套数</div>
                                    <div id="homework-sets" class="item-input c-gray">
                                    </div>

                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="item-content">

                                    <div class="item-title label">题目类型</div>

                                    <div id="homework-type" class="item-input c-gray">
                                    </div>

                                </div>
                            </td>

                        </tr>
                        <tr>

                            <td colspan="2">
                                <div class="item-content">

                                    <div class="item-title label">得分</div>
                                    <div id="homework-score" class="item-input c-gray">
                                    </div>

                                </div>
                            </td>
                        </tr>
                        <tr>

                            <!--<td colspan="2">-->
                                <!--<div class="item-content">-->

                                    <!--<div class="item-title label">备注</div>-->
                                    <!--<div id="homework-remark" class="item-input c-gray">-->
                                    <!--</div>-->

                                <!--</div>-->
                            <!--</td>-->

                            <td class="t-top pos-rel" colspan="2">
                                <div class="area-title">备注</div>
                                    <textarea class="c-gray" id="area2" name="describle" disabled="disabled"></textarea>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">作业图片 <span class="f-little tips">点击图片可放大查看</span></td>
                        </tr>
                        <tr>
                            <td colspan="2" class="t-center p-l-0 childImg">
                                <ul class="list">
                                    <!--<li><img src="../images/portrait.jpg" alt=""/></li>-->
                                    <!--<li><img id="work-img" src="" alt=""/></li>-->
                                </ul>
                            </td>
                        </tr>
                    </table>
                </div>
                    <!--<div class="content-block">-->
                        <!--<div class="row">-->
                            <!--<div class="col-80 t-center">-->
                                <!--<a id="save_btn" href="javascript:void(0);" class="button button-big button-fill button-success">确定</a>-->
                            <!--</div>-->
                        <!--</div>-->
                    <!--</div>-->
            </div>
        </div>
    </div>
</div>

    <section class="imgzoom_pack">
        <div class="imgzoom_x">X</div>
        <div class="imgzoom_img"><img src="" /></div>
    </section>

<script id="img-tpl" type="text/template">
    {@each imgList as it,index}
    <li><img id="work-img" src="&{it.FILE_PAHT}" alt=""/></li>
    {@/each}
</script>
<script>
    $(document).ready(function(){
        ImagesZoom.init({
            "elem": ".list"
        });
    });
    apiready=function(){
        juicer.set({
            'tag::operationOpen': '{@',
            'tag::operationClose': '}',
            'tag::interpolateOpen': '&{',
            'tag::interpolateClose': '}',
            'tag::noneencodeOpen': '$${',
            'tag::noneencodeClose': '}',
            'tag::commentOpen': '{#',
            'tag::commentClose': '}',
            'strip': false,
            'cache': false
        });
        //使每一个缩略图的高宽相等
        $(document).ready(function(){
            $(".item-img").css("height",$(".item-img").width()+10+"px");
        });

        //点击上传图片缩略图 添加删除按钮
        $(".add-homework").on("click",".img-wrap",function(){
            if($(this).find("img").length==1){
                if($(this).find(".img-close").length==0){
                    $(this).css("border-color","#ec9d9d")
                            .append('<div class="img-close">\
                        <span class="icon iconfont icon-guanbi"></span>\
                    </div>');
                }else{
                    $(this).css("border-color","#e7e7e7")
                            .find(".img-close").remove();
                }
            }
        });

        //作业id
        var taskId= api.pageParam.taskId;
        var taskSql="select * from stu_task where TASK_ID='{0}'";
        var fileSql="select * from stu_task_file where TASK_ID='{0}'";
        //作业类型列表
        var typeList=getTaskType("TaskType");

        //查询作业信息
        dbQuery(1,1,taskSql.format(taskId),true,function(ret,err){
            if(isObject(ret)&&ret.statusCode==0){
                $("#homework-sets").text(ret.result[0].TITLE_SETS);
                //根据类型id设置类型名称
                if(typeList){
                    for(var i=0;i<typeList.length;i++){

                        if(ret.result[0].TITLE_TYPE==typeList[i].CODE){
                            $("#homework-type").text(typeList[i].CODE_NAME);
                            break;
                        }
                    }
                }
                $("#homework-score").text(ret.result[0].SCORE);
                var remark=ret.result[0].REMARKS;
                if(remark==null||isEmpty(remark)){
                    remark="无";
                }
                $("#area2").text(remark);

            }

        });

        //查询作业图片
        dbQuery(1,20,fileSql.format(taskId),true,function(ret,err){
            if(isObject(ret)&&ret.statusCode==0){

                var imgData={
                    imgList:ret.result,
                    url:getUrl()
                }
                $(".list").prepend(juicer($("#img-tpl").html(), imgData));
                ImagesZoom.init({
                    "elem": ".list"
                });
            }
        });


        /*
        //作业id
        var workId= api.pageParam.workId;
        var sql="select * from s_assignment t where t.ASSIGNMENT_ID='{0}'";
        if(isNotNull(workId)){

            dbQuery(1,1,sql.format(workId),true,function(ret,err){
               if(isObject(ret)&&ret.statusCode==0){

                   var content=ret.result[0].CONTENT;
                   var desc=ret.result[0].COMPLETE_DESC;
                   var imgUrl=ret.result[0].PHOTO_FILE;
                   $("#work-content").text(content);
                   $("#work-desc").text(desc);
                   $("#work-img").attr("src",getUrl()+"upload/"+imgUrl);
               }

            });
        }*/



    };
</script>
<script>$.init();</script>
</body>
</html>






